#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Create by zhang
# Create on 2022/6/27 20:55
import os
from typing import List

from domain.report.common.file_type_enum import FileTypeEnum


def check_file_type(file_path:str, allow_suffix:List[FileTypeEnum]):
    if os.path.exists(file_path) and os.path.isfile(file_path) and allow_suffix and len(allow_suffix) > 0:
        arr = file_path.rsplit(".")
        suffies = [s.name for s in allow_suffix]
        if arr and len(arr) == 2 and arr[1].upper() in suffies:
            return True
    return False
